<?php

/**
 * marketing actions.
 *
 * @package    sf_sandbox
 * @subpackage marketing
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
 */
class marketingActions extends sfActions
{
    /**
     * Executes index action
     *
     */
    public function executeIndex()
    {
        $this->forward('default', 'module');
    }

    public function executeDistList()
    {
    }

    public function executeDoSaveDist()
    {
        $datetime = date("Y/m/d h:i:s A");

        $tbl_distributor = TblDistributorPeer::retrieveByPk($this->getRequestParameter('distId'));
        $tbl_distributor->setFName($this->getRequestParameter('fullname'));
        $tbl_distributor->setFNickname($this->getRequestParameter('nickname'));
        $tbl_distributor->setFIc($this->getRequestParameter('ic'));
        $tbl_distributor->setFCountry($this->getRequestParameter('country'));
        $tbl_distributor->setFAddress($this->getRequestParameter('address'));
        $tbl_distributor->setFPostcode($this->getRequestParameter('postcode'));
        $tbl_distributor->setFEmail($this->getRequestParameter('email'));
        $tbl_distributor->setFContact($this->getRequestParameter('contact'));
        $tbl_distributor->setFGender($this->getRequestParameter('gender'));
        $tbl_distributor->setFDob($this->getRequestParameter('dob'));
        $tbl_distributor->setFBankName($this->getRequestParameter('bankName'));
        $tbl_distributor->setFBankAccNo($this->getRequestParameter('bankAccNo'));
        $tbl_distributor->setFBankHolderName($this->getRequestParameter('bankHolderName'));
        $tbl_distributor->setFStatus($this->getRequestParameter('f_status'));

        $tbl_distributor->save();

        $tbl_user = TblUserPeer::retrieveByPk($tbl_distributor->getFUserId());
        $tbl_user->setFPassword($this->getRequestParameter('password'));

        $tbl_user->save();

        $output = array(
            "error" => false
        );
        echo json_encode($output);
        return sfView::HEADER_ONLY;
    }
}
